package com.youxue.service;

import com.youxue.dao.DynamicMapper;
import com.youxue.entity.Dynamic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by ACER on 2018/1/20.
 */
@Service("Dynamic")
public class DynamicServiceImpl implements DynamicService {
    @Autowired DynamicMapper dynamicMapper;

    @Override
    public Dynamic select(int id) {
        return dynamicMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Dynamic> test(Integer userId) {
        return dynamicMapper.selectTest(userId);
    }

    @Override
    public int insertDynamic(Dynamic dynamic) {
        return dynamicMapper.insertSelective(dynamic);
    }

    @Override
    public int selectTotalRecord() {
        return dynamicMapper.selectTotalRecord();
    }

    @Override
    public List<Dynamic> showAllDynamicByPage(Integer startPro, Integer pageSize) {
        return dynamicMapper.showAllDynamicByPage(startPro, pageSize);
    }

    @Override
    public List<Dynamic> showUnknownNews(Integer userId) {
        return dynamicMapper.showUnknownNews(userId);
    }

    @Override
    public List<Dynamic> showNews(Integer userId) {
        return dynamicMapper.showNews(userId);
    }

    @Override
    public Integer readNews(Integer replayId, Integer interactionId) {
        return dynamicMapper.readNews(replayId, interactionId);
    }

    @Override
    public Dynamic showOneDynamic(Integer dynamicId) {
        return dynamicMapper.showOneDynamic(dynamicId);
    }

    @Override
    public List<Dynamic> showAUserListDynamics(Integer dynamicUserId) {
        return dynamicMapper.selectAUserListDynamics(dynamicUserId);
    }

    @Override
    public int deleteADynamic(Integer dynamicId) {
        return dynamicMapper.deleteByPrimaryKey(dynamicId);
    }

    @Override
    public Dynamic showAllReview(Integer dynamicId) {
        return dynamicMapper.showAllReview(dynamicId);
    }

    @Override
    public void giveLike(Integer dynamicDynamicId) {
        dynamicMapper.giveLike(dynamicDynamicId);
    }


    @Override
    public int countLike(Integer dynamicDynamicId) {
        return dynamicMapper.countLike(dynamicDynamicId);
    }


}
